#include "tcp_server.hpp"
#include "daemon.hpp"
#include <memory>

void usage()
{
    std::cout << "usage:\n\t" << "./tcp_server server_port\n" << std::endl; 
}

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        usage();
        exit(USAGE_ERR);
    }

    uint16_t server_port = atoi(argv[1]);
    std::unique_ptr<ns_server::tcp_server> server(new ns_server::tcp_server(server_port));

    server->InitServer();
    Daemon();
    server->Start();

    return 0;
}